setFormReadOnly = function(form, readOnly) {
    setItemsReadOnly = function(items, readOnly) {
        items.each(function(item) {
                    var childitems = item.items;
                    if (!Ext.isEmpty(childitems, false)) {
                        setItemsReadOnly(childitems, readOnly);
                    } else {
                        if (item.xtype != "button" && (item.xtype != "gridview")) {
                            if(!Ext.isEmpty(item.stateId) && (item.stateId == "readOnly")){
                                return ;
                            }
                            item.setReadOnly(readOnly);
                            if (readOnly) {
                                item.setFieldStyle("background:#E6E6E6");
                            } else {
                                item.setFieldStyle("background:#FFFFFF");
                            }
                        }
                    }
                });
    }
    setItemsReadOnly(form.items, readOnly);
}

methodPost = function(url,method,datas){
	Ext.Ajax.request({
	    url: '/'+url+'/'+method,
	    method: 'POST',
	    async: false,   //ASYNC 是否异步( TRUE 异步 , FALSE 同步)
	    params: JSON.stringify(datas),
	    headers: {
	    	'Content-Type':'application/json'
	    },
	    success: function(response){
	        var text = response.responseText;
	        alert(JSON.stringify(text));
	    },
	    failure: function (response, options) {
            Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号：' + response.status);
        }
	});
	
}

getDatas = function(activeTab){	
	var downForm = activeTab.down('form');//获取活动窗口下的form
	var datas = downForm.getForm().getValues();//获取form下的所有值
	var grid = Ext.pluck(activeTab.down('grid').getStore().data.items,'data');//grid中所有的数据 
	Ext.each(grid,function(item){
		item.billNo = datas.billNo; //循环给详表billNo复制
	});
	datas.details = grid;
	return datas;
}